package com.myself.cloud.entity;

import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * select-service-center
 *
 */
public class BaseFormat {

    public static final String DATE_PATTERN = "yyyy-MM-dd HH:mm:ss";
    public static final SimpleDateFormat SIMPLE_DATE_FORMAT = new SimpleDateFormat(DATE_PATTERN);

    public static final String DECIMAL_PATTERN = "#.00";
    public static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat(DECIMAL_PATTERN);

    public static Date toDate(String time) {
        if (time == null) {
            return null;
        }
        try {
            return SIMPLE_DATE_FORMAT.parse(time);
        } catch (ParseException e) {
            return null;
        }
    }
}
